<?php
    //
    require '../model/application.php';

    $app = new Applications();
    // dau tien se lay tat ca du lieu cua bang app_lists
    $data = array();

    if(!isset($_POST['status']) || $_POST['status'] == "")
    {
        $data = $app->getListApplications();
        $choice = 'chon_tat_ca';
    }
    else
    {
        $stt = $_POST['status']; // get variable from client
        $data = $app->listAppByStatus($stt);
        $choice = "chon_tuy_bien";
    }

    $_responseServer = array(
                            "dulieu" => $data,
                            "loc_du_lieu"=>$choice
                       );
    $jsonString = json_encode($_responseServer);
    // tra ve bien $jsonString cho phia client
    echo $jsonString;
